package com.lvhx.springboot.springbatch.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.annotation.AfterJob;
import org.springframework.batch.core.annotation.AfterStep;
import org.springframework.batch.core.annotation.BeforeJob;
import org.springframework.batch.core.annotation.BeforeStep;

/**
 * @auther 吕宏旭
 * @date 2019/9/5 12:57
 */
@Slf4j
public class JobExecListener {
    @BeforeJob
    @BeforeStep
    public void beforJob(JobExecution jobExecution) {
        log.info("=====before start time: " + jobExecution.getStartTime());
    }

    @AfterJob
    @AfterStep
    public void afterJob(JobExecution jobExecution) {
        log.info("=====after end time: " + jobExecution.getEndTime());
    }
}
